export {
  post
}
let pendings = [];
function post(num) {
	console.log('post')
   return token(num)
   
}

function token(num){
	
	return new Promise((resolve, reject)=>{
		if(num%2 === 0)
		{
			if(num%4 === 0)
			{
				fn();
				console.log(pendings)
				pendings.push(() => {
					console.log('aaa')
				    resolve(post('num+2'))
				})
				console.log(pendings)
				
			}
			// console.log(num)
			else{
				resolve(num)
			}
			
		}else{
			
			reject('错误了')
		}
	})
}
function fn(){
	return pendings.map((callback) => {
		console.log(pendings)
	    callback();
	})
}
